package com.zzl.admin.thread;

/**
 * 参考：https://baijiahao.baidu.com/s?id=1653790035315010634&wfr=spider&for=pc
 * description: 测试ThreadLocal
 * @author 朱正磊
 * @date 2022-05-24 15:43:03
 */
public class ThreadLocalTest2 {

    private static ThreadLocal<String> threadLocal1 = new ThreadLocal<>();

    private static ThreadLocal<Integer> threadLocal2 = new ThreadLocal<>();

    /**
     * description: 测试ThreadLocal
     * @author 朱正磊
     * @date 2022-05-24 15:44:02
     * @param args 参数
     */
    public static void main(String[] args) {
        threadLocal1.set("lisi");
        String value1 = ThreadLocalTest2.threadLocal1.get();
        // value1 = lisi
        System.out.println("value1 = " + value1);

        threadLocal2.set(100);
        Integer value2 = ThreadLocalTest2.threadLocal2.get();
        // value2 = 100
        System.out.println("value2 = " + value2);
    }

}
